load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss")
load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("sapling")

rust_library(
    name = "metrics",
    srcs = glob(["src/**/*.rs"]),
    autocargo = {"cargo_toml_config": {
        "extra_buck_dependencies": {"dependencies": [
            "//common/rust/shed/fbinit:fbinit",
            "//common/rust/shed/stats:stats",
            "//common/rust/shed/stats:stats_traits",
        ]},
        "features": {
            "default": [],
            "ods": [
                "fbinit",
                "stats",
                "stats_traits",
            ],
        },
        "lib": {"name": "metrics"},
        "package": {
            "authors": ["Meta Source Control Team <sourcecontrol-dev@meta.com>"],
            "homepage": "https://sapling-scm.com/",
            "license": "MIT",
            "name": "sapling-metrics",
            "repository": "https://github.com/facebook/sapling",
        },
    }},
    crate_root = "src/lib.rs",
    features = [
    ] + ([] if rust_oss.is_oss_build() else ["ods"]),
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:fastrand",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:once_cell",
        "fbsource//third-party/rust:parking_lot",
    ] + ([] if rust_oss.is_oss_build() else [
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/monitoring:obc_lib",
        "//common/rust/shed/stats:stats",
        "//common/rust/shed/stats:stats_traits",
        "//eden/scm/lib/util/sysutil:sysutil",
    ]),
)
